using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class frm_Category2Map : EntityTypeConfiguration<frm_Category2>
    {
        public frm_Category2Map()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Name)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("frm_Category2");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Order).HasColumnName("Order");

            // Relationships
            this.HasOptional(t => t.frm_Type2)
                .WithMany(t => t.frm_Category2)
                .HasForeignKey(d => d.Type);

        }
    }
}
